<template>
  <loading-text v-if="loading"></loading-text>
  <div v-else class="form-list">
    <div class="form-list-item">
      <div class="label">姓名</div>
      <div class="content">{{detail.aac003 || '--'}}</div>
    </div>
    <div class="form-list-item">
      <div class="label">身份证号</div>
      <div class="content">{{detail.aac002 || '--'}}</div>
    </div>
    <div class="form-list-item">
      <div class="label">档案号</div>
      <div class="content">{{detail.archiveCode || '--'}}</div>
    </div>
    <div class="form-list-item">
      <div class="label">手机号</div>
      <div class="content">{{detail.contactNumber || '--'}}</div>
    </div>
    <div class="form-list-item">
      <div class="label">职称类别</div>
      <div class="content">{{detail.titleType || '--'}}</div>
    </div>
    <div class="form-list-item">
      <div class="label">职称级别</div>
      <div class="content">{{detail.declarationLevel || '--'}}</div>
    </div>
    <div class="form-list-item">
      <div class="label">职称系列</div>
      <div class="content">{{detail.titleSeries || '--'}}</div>
    </div>
    <div class="form-list-item">
      <div class="label">职称专业</div>
      <div class="content">{{detail.titleProfession || '--'}}</div>
    </div>
    <div class="form-list-item">
      <div class="label">职务</div>
      <div class="content">{{detail.nowTitleGrade || '--'}}</div>
    </div>
    <div class="form-list-item">
      <div class="label">申报时间</div>
      <div class="content">{{detail.declareYear || '--'}}</div>
    </div>
    <div class="file-list form-list" v-if="fileList.length">
      <div class="tit">附件列表</div>
      <loading-text v-if="loading"></loading-text>
      <empty tip="无数据~" v-if="!fileList.length"></empty>
      <yd-lightbox :num="fileList.length">
        <div class="form-list-item" v-for="(val, key) in fileList" :key="key">
          <div class="label">{{val.fileName}}</div>
          <div class="content">
            <yd-lightbox-img :src="$getImg(val.filePath)"></yd-lightbox-img>
          </div>
        </div>
      </yd-lightbox>
    </div>
  </div>
</template>

<script>
  import LoadingText from '../../../components/loading-text/loading-text'
  import Empty from '../../../components/empty/empty'
  export default {
    name: 'detail-title',
    components: {Empty, LoadingText},
    data() {
      return {
        loading: true,
        detail: {},
        fileList: []
      }
    },
    methods: {
      getDetail() {
        this.$post('/admin/person/sapi/title/declaration/save/apply/getTitleDetails', {
          titleDeclarationId: this.$route.query.id
        }, loading => { this.loading = loading }).then(res => {
          this.detail = res.data.titleMessage
          this.fileList = res.data.fileimg
        })
      }
    },
    created() {
      this.getDetail()
    }
  }
</script>

<style scoped lang="scss">
  .file-list{
    margin: .2rem 0 0 0;
    .tit{
      padding: .2rem 0;
      text-align: center;
      font-size: .3rem;
    }
    .label{
      width: 2rem;
      word-break: break-all;
      white-space: normal;
    }
    img{
      width: 2.5rem;
    }
    .form-list-item{
      align-items: center;
    }
  }
</style>
